const dotenv = require('dotenv');
dotenv.config({path: `./.env.${process.argv[2]}`});

const {Sequelize} = require('sequelize');
// 方法 3: 分别传递参数 (其它数据库)
const sequelize = new Sequelize(process.env.PG_DATABASE, process.env.PG_USERNAME, process.env.PG_PASSWORD, {
    host: process.env.PG_HOST,
    port: process.env.PG_PORT,
    dialect: "postgres", /* 选择 'mysql' | 'mariadb' | 'postgres' | 'mssql' 其一 */
    pool: {
        max: 5,
        min: 5,
        idle: 10000
    }, /* 连接池配置 */
});

module.exports = sequelize
